package cz.muni.fi.pa165.library.api;

import java.util.List;
import javax.jws.WebService;

/**
 *
 * @author Matúš Abaffy
 */
@WebService
public interface ReaderService {

    /**
     * Generates unique id for the new reader and stores this reader into
     * database.
     *
     * @param reader reader entity to be created
     * @return created reader with new id
     * @throws IllegalArgumentException if reader is null, reader's attributes
     * are not correct or sufficient (especially if there is already a reader in
     * the database with same birth number or email)
     */
    public ReaderTO createReader(ReaderTO reader) throws IllegalArgumentException;

    /**
     * Returns a list of all readers in the database.
     *
     * @return list of all books in the database.
     */
    public List<ReaderTO> findAllReaders();
    
    /**
     * Returns reader with given id.
     *
     * @param id reader's id
     * @return reader with given id or null if such reader does not exist
     * @throws IllegalArgumentException if id is null
     */
    public ReaderTO findReaderById(Long id) throws IllegalArgumentException;

    //Pre Filipka
    public ReaderTO findReaderByEmail(String email) throws IllegalArgumentException;
    
    /**
     * Updates reader that is already in database.
     *
     * @param reader updated reader to be stored into database
     * @throws IllegalArgumentException if reader is null or reader's attributes
     * are not correct
     */
    public void updateReader(ReaderTO reader) throws IllegalArgumentException;

    /**
     * Deletes reader from database.
     *
     * @param reader reader to be deleted from database
     * @throws IllegalArgumentException if reader is null
     */
    public void deleteReader(ReaderTO reader) throws IllegalArgumentException;
    
    public List<ReaderTO> findReaderByFull(String firstName, String surname, String email);
    
    public List<ReaderTO> findReaderByName(String firstName, String surname) throws IllegalArgumentException;        
    
    public ReaderTO findReaderByBirthNumber(String birthNumber) throws IllegalArgumentException;
    
     /**
     * Try to authentize user.
     *
     * @param email reader's email
     * @param password reader's password
         * @return reader instace if authentizazion is sucessfull, null otherwise
     */
        ReaderTO authentize(String email, String password);

     

}
